package com.rerun.common.rabbitmq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.io.UnsupportedEncodingException;

/**
 * Created with IntelliJ IDEA.
 * Author: Dax
 * Description:
 * Date: 2017/11/18
 * Time: 19:36
 */


public class Consumer implements MessageListener {
    private static final Logger log = LoggerFactory.getLogger(Consumer.class);


    @Override
    public void onMessage(Message message) {
        try {
            Thread.sleep(15000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       byte[] bytes= message.getBody();
        try {
            log.info(new String(bytes,"UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
